//
//  BaseViewController.m
//  WangLottery
//
//  Created by leven hu on 12-4-22.
//  Copyright 2012年 __MyCompanyName__. All rights reserved.
//

#import "BaseViewController.h"

@implementation BaseViewController


+(NSString *)lotteryNameByLottry:(LotteryType)lottery{

    if (lottery==0) {
        return nil;
    }
    NSArray *tempArray=[[NSArray alloc]initWithObjects:@"双色球",@"大乐透",
                        @"3D",@"排列三",@"排列五",@"七乐彩",@"七星彩",
                        @"22选5", nil];
    NSString *name;
    if (lottery-1<tempArray.count) {
        name=[tempArray objectAtIndex:lottery-1];
    }else {
        name=nil;
    }
    [tempArray release];
    return name;
}
#pragma mark -UITableViewDelegate

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 0;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    return nil;
}

#pragma mark-UIPickerViewDalegate

-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{

    return 0;
}

-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{

    return 0;
}

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{

    return nil;
}

- (void)initViewControl{
}
#pragma mark- 
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    
  /*  UIImage *backImg=[UIImage imageNamed:@"bg.png"];
    UIImageView *bgImgView=[[UIImageView alloc]initWithImage:backImg];
    bgImgView.autoresizingMask=UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
    bgImgView.frame=CGRectMake(0.0f, 0.0f, self.view.frame.size.width, self.view.frame.size.height);
    [self.view insertSubview:bgImgView atIndex:0];
    [backImg release];*/
    
    UIImageView *navBkg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ToolBar.png"]];
    navBkg.frame = CGRectMake(0, 0, 320, 44);
    [self.navigationController.navigationBar insertSubview:navBkg atIndex:1];
    //self.navigationController.navigationBar.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"ToolBar.png"]];
    
    // Set the nav bar's background
    
}


-(void)changeBackNavItem{

    backItemButton=[UIButton buttonWithType:UIButtonTypeCustom];
    UIImage *btnImg=[UIImage imageNamed:@"red_arrow.png"];
    [backItemButton setBackgroundImage:btnImg forState:UIControlStateNormal];
    backItemButton.frame=CGRectMake(0.0f, 7.0f, 60.0f, 30.0f);
    [backItemButton setTitle:@"返回" forState:UIControlStateNormal];
    backItemButton.titleEdgeInsets=UIEdgeInsetsMake(0.0f, 5.0f, 0.0f, 0.0f);
    backItemButton.titleLabel.font=[UIFont boldSystemFontOfSize:14.0f];
    [backItemButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    UIBarButtonItem *leftItem=[[UIBarButtonItem alloc]initWithCustomView:backItemButton];
    self.navigationItem.leftBarButtonItem=leftItem;
    [leftItem release];
    
 /*  CustomNavigationBar* customNavigationBar = (CustomNavigationBar*)self.navigationController.navigationBar;
    
    // Set the nav bar's background
    [customNavigationBar setBackgroundWith:[UIImage imageNamed:@"navigationBarBackButton.png"]];
    
    UIButton* backButton = [customNavigationBar backButtonWith:[UIImage imageNamed:@"navigationBarBackButton.png"] highlight:nil leftCapWidth:14.0];
    
    backButton.titleLabel.textColor = [UIColor colorWithRed:254.0/255.0 green:239.0/255.0 blue:218.0/225.0 alpha:1];
    self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:backButton] autorelease];
    */
    
    
}
- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
